// ---------------------------------------------------------------------
//
// -- 加载信息
// -- author £
//
// ---------------------------------------------------------------------

cc.Class({
    extends: cc.Component,

    properties: {
        icon: cc.Sprite,
        info: cc.Label,
        iconAn: cc.Animation,
        icons: {
            default: [],
            type: cc.SpriteFrame
        }
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.node.active = false;
    },

    start () {

    },

    show: function (info, state) {
        if (info === null || info === undefined) {
            this.hide();
            return;
        }

        if (!state) state = 0;
        
        this.node.active = true;
        this.icon.spriteFrame = this.icons[state];
        this.info.string = info;

        if (state === 0) {
            this.iconAn.play();
        } else {
            this.iconAn.stop();
            this.icon.node.rotation = 0;
        }
    },

    hide: function () {
        this.node.active = false;
        this.iconAn.stop();
        this.icon.node.rotation = 0;
    },

    // update (dt) {},
});
